---
id: serial_master
title: Serial
sidebar_label: Serial
slug: /api/master/serial
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Use the `MasterChannel::createSerialChannel` method to create a channel bound to a serial port. It requires the same serial port configuration parameters as the outstation serial port API.

Unlike the outstation API, the master API opens the serial port API lazily after `MasterChannel.enable()` is called. It will try to open the port
if the operation fails.

:::note
The `LinkErrorMode` is internally set to `Discard` for serial communication channels.
:::

<Tabs
groupId="language"
defaultValue="Rust"
values={[
{label: 'Rust', value: 'Rust'},
{label: 'C', value: 'C'},
{label: 'C++', value: 'C++'},
{label: 'Java', value: 'Java'},
{label: 'C#', value: 'C#'},
]}>
<TabItem value="Rust">

```rust
{{#include ../dnp3/examples/master.rs:create_master_serial_channel}}
```

</TabItem>
<TabItem value="C">

```c
{{#include ../ffi/bindings/c/master_example.c:create_master_serial_channel}}
// check error
```

</TabItem>
<TabItem value="C++">

```cpp
{{#include ../ffi/bindings/c/master_example.cpp:create_master_serial_channel}}
```

</TabItem>
<TabItem value="Java">

```java
{{#include ../ffi/bindings/java/examples/src/main/java/io/stepfunc/dnp3/examples/MasterExample.java:create_serial_channel}}
```

</TabItem>
<TabItem value="C#">

```csharp
{{#include ../ffi/bindings/dotnet/examples/master/Program.cs:create_serial_channel}}
```

</TabItem>
</Tabs>
